from gm.api import *
import talib
import numpy as np
import matplotlib.pyplot as plt

set_token("2f6fc0b33f43707de870abf5b0c2f9bade9204f2")
print(get_constituents("SHSE.000922", fields=None, df=False))
data = history_n(symbol="SHSE.600559",frequency="1d",count=100,end_time="2021-01-07",fields="high,low,close,open,volume",fill_missing="last",adjust=ADJUST_PREV,df=True)

close = np.asarray(data["close"].values)
open = np.asarray(data["open"].values)
high = np.asarray(data["high"].values)
low = np.asarray(data["low"].values)
volume = np.asarray(data["volume"].values).astype(np.double)

cdl2crows = talib.CDL2CROWS(high,low,close,volume)
cdlkicking = talib.CDLKICKING(open,high,low,close)
cdlinneck = talib.CDLINNECK(open,high,low,close)
cdlhomingpigeon = talib.CDLHOMINGPIGEON(open,high,low,close)
cdlhikkake=talib.CDLHIKKAKE(open,high,low,close)
print(cdl2crows)
print(cdlkicking)
print(cdlinneck)
print(cdlhomingpigeon)
print(cdlhikkake)